#ifndef CHATFORM_H
#define CHATFORM_H

#include <QWidget>
#include "moveableframelessdialog.h"
#include "chatmessage/qnchatmessage.h"
#include <QListWidgetItem>
#include <QTextCharFormat>
#include <QFontInfo>
#include "qmsgtextedit.h"
#include "qmsgbrowser.h"
#include "emotionwindow.h"
#include <QVBoxLayout>
#include <QFile>

namespace Ui {
class chatForm;
}
class myFont{
public:
    QString family;
    int fontsize;
    QFont::Weight bold;
    bool ital;
    bool underline;
    QColor color;
};

class chatForm : public MoveableFramelessDialgo
{
    Q_OBJECT

public:
    explicit chatForm(QString titleText,QString uuid,int fd,QWidget *parent = 0);
    ~chatForm();
QWidget*getDragnWidget();

    void dealMessage(QNChatMessage *messageW, QListWidgetItem *item, QString text, QString time, QNChatMessage::User_Type type);//解除消息
    void dealMessageTime(QString curMsgTime);
    void htmldealMessage(QNChatMessage *messageW, QListWidgetItem *item, QString text, QString time, QNChatMessage::User_Type type);//解除消息
    void ReceivedMessage(QString msg);//发到消息
    void onThemeColorChange(QString colorStr);
protected:
    void showMsg(QString msg,bool bsend=true);
    void initFontWidget();
    void mergeFormatOnWordOrSelection(const QTextCharFormat &format);
    void initControl();
    void setSendBtnMenu();
    void closeEvent(QCloseEvent *event);

private:
    Ui::chatForm *ui;
    QString m_uuid;
    int m_fd;
    myFont m_font;
    QAction *m_sendAction;
    QAction *m_ctrlSendAction;
    EmotionWindow *m_emotionWindow;



private slots:
    void doClose();
    void doMinbox(bool);
    void onSendBtnClicked(bool);
    void doFont(bool);
    void onFontFamilycurrentIndexChanged(const QString &family);
    void onFontSizecurrentIndexChanged(const QString &size);
    void onBoldBtnCLicked(bool);
    void onItalBtnCLicked(bool);
    void onUnderBtnCLicked(bool);
    void onColorBtnCLicked(bool);
    void currentCharFormatChanged(const QTextCharFormat &format);
    void onEnterAction();
    void onEnterCtrlAction();
    void onEmotionBtnClicked(bool);
    void onSetEmotionBtnStatus();
    void onEmotionItemClicked(QString filename);
    void doClearSend(bool);
    void doSendText(bool);
    void doFile(bool);
    void doRemote();
signals:



};

#endif // CHATFORM_H
